package com.twu.biblioteca;

public class Movie {
    private String title;
    private int year;
    private String director;
    private String rating;

    public String getTitle() {
        return title;
    }

    public int getYear() {
        return year;
    }

    public String getDirector() {
        return director;
    }

    public String getRating() {
        return rating;
    }

    private void setRating(String rating) {

        try {
            if (Validator.validateMovieRating(rating)) this.rating = rating;
        } catch (InvalidMovieRatingException e) {
            System.out.println(e.getErrorMessage());
        }

    }

    public Movie(String title, int year, String director, String rating) {
        this.title = title;
        this.year = year;
        this.director = director;
        this.setRating(rating);

    }
}
